코드
library(patchwork)
library(corrplot)Choi Pro
아래는 R을 이용한 데이터 전처리 예제입니다. 문제와 답만 있습니다. 풀이 과정을 코드로 제출하세요. 제출 결과에 따라 다음 과정의 Project 3 난이도 조정이 됩니다.
신뢰성 평가 결과 데이터 셋 다운로드
OLED 패널의 신뢰성 평가 결과 데이터이다.
** Reliability Test Split Conditions**
| Test Type | Description | Test Condition |
|---|---|---|
| HTS | High Temperature Storage | 85℃, 500h/1000h |
| T/C | Temperature Cycle | -30℃(1h) ↔︎ 85℃(1h), 500h/1000h |
| THS | Temperature Humidity Storage | 60℃/90%RH, 500h/1000h |
| T/S | Thermal Shock | -45℃(30min) ↔︎ 85℃(30min), 500h/1000h |
이 신뢰성 평가는 다음과 같은 주요 변수들로 구성되어 있습니다:
Test_type Panel Test_duration Result Sample_count
1 HTS Flexible_OLED 1000h Fail 4
2 HTS Flexible_OLED 1000h Pass 199
3 HTS Flexible_OLED 500h Fail 0
4 HTS Flexible_OLED 500h Pass 140
5 HTS Rigid_OLED 1000h Fail 118
6 HTS Rigid_OLED 1000h Pass 5
# A tibble: 8 × 3
# Groups: Test_type [4]
Test_type Result 샘플수
<chr> <chr> <int>
1 HTS Fail 122
2 HTS Pass 401
3 TC Fail 167
4 TC Pass 271
5 THS Fail 528
6 THS Pass 602
7 TS Fail 101
8 TS Pass 622
p3 <- df |>
group_by(Test_type, Result) |>
summarise(샘플수 = sum(Sample_count )) |>
ggplot(aes(x=Test_type, y=샘플수, fill=Result))+
geom_bar(stat = "identity", position = "dodge")+
geom_text(aes(label = 샘플수), position = position_dodge(0.9),
vjust = -0.5) +
labs(title = "신뢰성 종류별 Pass/Fail 샘플수",
x="신뢰성 평가 종류",
y="샘플수")
ggplotly(p3)table1 <- df |>
filter(Test_type %in% c("HTS", "THS")) |>
filter(Result =="Fail") |>
group_by(Test_type,Panel, Test_duration) |>
summarise(n_Fail = sum(Sample_count))
table2 <- df |>
filter(Test_type %in% c("HTS", "THS")) |>
filter(Result =="Pass") |>
group_by(Test_type,Panel, Test_duration) |>
summarise(n_Pass = sum(Sample_count))
table3 <- left_join(table1,table2) |>
mutate(양품율 = round(n_Pass/(n_Pass + n_Fail)*100,1))
table3# A tibble: 8 × 6
# Groups: Test_type, Panel [4]
Test_type Panel Test_duration n_Fail n_Pass 양품율
<chr> <chr> <chr> <int> <int> <dbl>
1 HTS Flexible_OLED 1000h 4 199 98
2 HTS Flexible_OLED 500h 0 140 100
3 HTS Rigid_OLED 1000h 118 5 4.1
4 HTS Rigid_OLED 500h 0 57 100
5 THS Flexible_OLED 1000h 89 14 13.6
6 THS Flexible_OLED 500h 17 500 96.7
7 THS Rigid_OLED 1000h 387 13 3.2
8 THS Rigid_OLED 500h 35 75 68.2
p <- table3 |>
mutate(Test_duration = fct_reorder(Test_duration, -양품율)) |>
ggplot(aes(x = Test_duration, y =양품율, fill = Panel)) +
geom_bar(stat = "identity", position = "dodge")+
geom_text(aes(label = 양품율), position = position_dodge(0.9), vjust = -0.5) +
facet_wrap(~Test_type)+
labs(title = "테스트 조건별 양품율",
x = "테스트 시간(h)",
y = "양품율(%)",
fill = "결과") +
theme_bw()
ggplotly(p)# A tibble: 8 × 3
# Groups: Test_type [4]
Test_type Result n
<chr> <chr> <int>
1 HTS Fail 4
2 HTS Pass 199
3 TC Fail 13
4 TC Pass 40
5 THS Fail 89
6 THS Pass 14
7 TS Fail 3
8 TS Pass 70
-geom_tile 그래프로 그리기 (x축: Result, y축: Test_type, fill: percentage )